import cv2
import numpy as np

img = cv2.imread("./img/cat.png")
h,w,d = img.shape

gray_img = np.zeros((h,w,d),dtype=np.uint8)
for i in range(h):
    for j in range(w):
        # 最大值
        n = max(img[i,j][0] / 255,img[i,j][1] / 255,img[i,j][2] / 255)
        gray_img[i, j] = n * 255

cv2.imshow("gray",gray_img)
cv2.waitKey(0)

